home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt40s3.arc / PIBTDCL1.GLO < prev    next >
Encoding:
Text File  |  1987-09-22  |  50.7 KB  |  1,027 lines

  1. (*----------------------------------------------------------------------*)
  2. (*                   GLOBAL VARIABLE DEFINITIONS                        *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. CONST
  6.                    (* 8086/8088 hardware flags *)
  7.  
  8.    Carry_Flag     = 1;
  9.    Parity_Flag    = 4;
  10.    Aux_Carry_Flag = 16;
  11.    Zero_Flag      = 64;
  12.    Sign_Flag      = 128;
  13.  
  14. TYPE
  15.  
  16.    AnyStr    = STRING[255]  (* Matches any string for parameter passing *);
  17.  
  18.    StringPtr = ^AnyStr      (* Points to a string                       *);
  19.  
  20.    ShortStr  = STRING[30]   (* Short string *);
  21.  
  22.    String1   = STRING[1]    (* 1-character string  *);
  23.  
  24.    String10  = STRING[10]   (* 10-character string *);
  25.  
  26.    String12  = STRING[12]   (* 12-character string *);
  27.  
  28.    KeyStr    = STRING[65]   (* Function key string *);
  29.  
  30.    KeyStrPtr = ^KeyStr      (* Points to function key string *);
  31.  
  32.    FileStr   = STRING[65]   (* File name string *);
  33.  
  34.    RegPack   = RECORD       (* 8086/8088 registers                      *)
  35.                   CASE INTEGER OF
  36.                      1: ( Ax, Bx, Cx, Dx, Bp, Si, Di, Ds, Es, Flags : INTEGER );
  37.                      2: ( Al, Ah, Bl, Bh, Cl, Ch, Dl, Dh            : BYTE    );
  38.                END;
  39.  
  40.    Text_File      = TEXT [512]     (* General text file                 *);
  41.  
  42.                                    (* Comparison types for string tests *)
  43.  
  44.    Comparer       = ( Less, Equal, Greater );
  45.  
  46.                                    (* Character set definitions *)
  47.    CharSet        = SET OF CHAR;
  48.  
  49. (*----------------------------------------------------------------------*)
  50. (*               ASCII character set definitions                        *)
  51. (*----------------------------------------------------------------------*)
  52.  
  53. CONST
  54.  
  55.    NUL  = 0          (* NULL            *);
  56.    ETX  = 3          (* ETX = ^C        *);
  57.    ENQ  = 5          (* ENQ = Enquiry   *);
  58.    BELL = 7          (* BELL = bell     *);
  59.    BS   = 8          (* Backspace       *);
  60.    HT   = 9          (* Horizontal Tab  *);
  61.    LF   = 10         (* Line Feed       *);
  62.    VT   = 11         (* Vertical Tab    *);
  63.    FF   = 12         (* Form Feed       *);
  64.    CR   = 13         (* Carriage Return *);
  65.    SO   = 14         (* Start grahics   *);
  66.    SI   = 15         (* End graphics    *);
  67.    DLE  = 16         (* Data link esc.  *);
  68.    XON  = 17         (* XON             *);
  69.    XOFF = 19         (* XOFF            *);
  70.    SUB  = 26         (* End of file     *);
  71.    ESC  = 27         (* Escape          *);
  72.    FS   = 28         (* Graphics start  *);
  73.    GS   = 29         (* Graphics start  *);
  74.    RS   = 30         (* Inc. plot start *);
  75.    US   = 31         (* Graphics end    *);
  76.    SP   = 32         (* Space           *);
  77.    DEL  = 127        (* Delete          *);
  78.  
  79. (*----------------------------------------------------------------------*)
  80. (*                    Copyright notice                                  *)
  81. (*----------------------------------------------------------------------*)
  82.  
  83. (* STRUCTURED *) CONST
  84.    CopyRight_Notice : STRING[47] = 'Copyright (c) 1985,1986,1987 by Philip R. Burns';
  85.  
  86. (*----------------------------------------------------------------------*)
  87. (*                    Program version                                   *)
  88. (*----------------------------------------------------------------------*)
  89.  
  90. VAR
  91.    Pibterm_Version : KeyStr        (* Version of PibTerm       *);
  92.    Pibterm_Date    : KeyStr        (* Date of PibTerm version  *);
  93.    Test_Version    : BOOLEAN       (* If a test version        *);
  94.  
  95. (*----------------------------------------------------------------------*)
  96. (*                    Command Line Parameters                           *)
  97. (*----------------------------------------------------------------------*)
  98.  
  99. VAR
  100.    Command_Script_File_Name   : FileStr;
  101.    Command_Config_File_Name   : FileStr;
  102.    Command_Dialing_File_Name  : FileStr;
  103.    Command_Prefix_File_Name   : FileStr;
  104.    Command_Translate_File_Name: FileStr;
  105.    Command_Function_Key_Name  : FileStr;
  106.    Command_Log_File_Name      : FileStr;
  107.    Command_Debug_Mode         : BOOLEAN;
  108.  
  109. (*----------------------------------------------------------------------*)
  110. (*                   PibTerm Command Types                              *)
  111. (*----------------------------------------------------------------------*)
  112.  
  113. CONST
  114.    No_Of_PibTerm_Commands           = 109;
  115.    No_Of_Pibterm_Commands_Minus_One = 108;
  116.  
  117. TYPE
  118.    PibTerm_Command_Type =
  119.       ( AddCommandSy,   AddLFSy,       AlarmSy,       AreaCodeSy,
  120.         BreakSy,        CallSy,        CaptureSy,     CaseSy,
  121.         ChDirSy,        ClearSy,       CloseSy,       ClrEolSy,
  122.         CommFlushSy,    DeclareSy,     DelaySy,       DelLineSy,
  123.         DialSy,         DoCaseSy,      DosSy,         EchoSy,
  124.         EditSy,         ElseSy,        ElseIfSy,      EndCaseSy,
  125.         EndDoCaseSy,    EndForSy,      EndIfSy,       EndProcSy,
  126.         EndWhileSy,     ExecuteSy,     ExeNewSy,      ExitSy,
  127.         ExitAllSy,      FastCSy,       FileSy,        ForSy,
  128.         GetDirSy,
  129.         GetParamSy,     GetVarSy,      GossipSy,      GoToSy,
  130.         GoToXYSy,       HangUpSy,      HostSy,        IfConSy,
  131.         IfDialSy,       IfEofSy,       IfExistsSy,    IfFoundSy,
  132.         IfLocStrSy,     IfOkSy,        IfOpSy,        IfRemStrSy,
  133.         ImportSy,       InfoSy,        InputSy,       InsLineSy,
  134.         KeyDefSy,       KeyFlushSy,    KeySendSy,     KeySy,
  135.         LabelSy,        LogSy,         MenuSy,        MessageSy,
  136.         MuteSy,         OpenSy,        ParamSy,       PImportSy,
  137.         ProcedureSy,    QuitSy,        ReadSy,        ReadLnSy,
  138.         ReceiveSy,      ReDialSy,      RepeatSy,      ResetSy,
  139.         ReturnSy,       RInputSy,      ScriptSy,      SDumpSy,
  140.         SendSy,         SetSy,         SetParamSy,    SetVarSy,
  141.         STextSy,        SuspendSy,     TextSy,        TimersSy,
  142.         TranslateSy,    UntilSy,       ViewSy,        WaitSy,
  143.         WaitCountSy,    WaitListSy,    WaitQuietSy,   WaitStrSy,
  144.         WaitTimeSy,     WhenSy,        WhenDropSy,    WhenListSy,
  145.         WhereXYSy,      WhileSy,       WriteSy,       WriteLnSy,
  146.         WriteLogSy,     ZapVarSy,      Bad_Command,   Null_Command
  147.       );
  148.  
  149.                                    (* Command to be executed *)
  150. VAR
  151.    PibTerm_Command : PibTerm_Command_Type;
  152.  
  153.                                    (* Conversion table from input to *)
  154.                                    (* commands.                      *)
  155. VAR
  156.    PibTerm_Command_Table : ARRAY[0..255] OF PibTerm_Command_Type;
  157.  
  158. (*----------------------------------------------------------------------*)
  159. (*                Timing constants and variables                        *)
  160. (*----------------------------------------------------------------------*)
  161.  
  162. TYPE
  163.    Date_Format_Type = ( MDY_Style, YMD_Style, DMY_Style );
  164.    Time_Format_Type = ( Military_Time, AMPM_Time        );
  165.  
  166. CONST
  167.    Half_Second_Delay       =  500  (* Delay argument for 1/2 sec. delay *);
  168.    One_Second_Delay        = 1000  (* Delay argument for 1 second delay *);
  169.    Two_Second_Delay        = 2000  (* Delay argument for 2 second delay *);
  170.    Three_Second_Delay      = 3000  (* Delay argument for 3 second delay *);
  171.    Tenth_of_a_second_Delay = 100   (* 1/10 second delay                 *);
  172.  
  173. VAR
  174.    Delay_Time            : INTEGER;(* Time to delay in response to DELAY *)
  175.                                    (* command                            *)
  176.    Break_Length          : INTEGER (* Length of line break in 1/10 secs  *);
  177.  
  178.    Current_Status_Time   : INTEGER (* Current time for status line       *);
  179.    New_Status_Time       : INTEGER (* Updated time for status line       *);
  180.    Time_Format           : Time_Format_Type (* Time format               *);
  181.    Date_Format           : Date_Format_Type (* Date format               *);
  182.  
  183. (*----------------------------------------------------------------------*)
  184. (*                          Text/Menu Colors                            *)
  185. (*----------------------------------------------------------------------*)
  186.  
  187. VAR
  188.    ForeGround_Color : INTEGER      (* Color for ordinary text           *);
  189.    BackGround_Color : INTEGER      (* Usual background color            *);
  190.    Border_Color     : INTEGER      (* Usual border color                *);
  191.  
  192.    Menu_Text_Color  : INTEGER      (* Color for menu text               *);
  193.    Menu_Title_Color : INTEGER      (* Color for menu titles             *);
  194.    Menu_Frame_Color : INTEGER      (* Color for menu frame              *);
  195.    Menu_Text_Color_2: INTEGER      (* Secondary color for menu text     *);
  196.    Text_Mode        : INTEGER      (* Text mode for all text            *);
  197.  
  198. (*----------------------------------------------------------------------*)
  199. (*                          Status line colors                          *)
  200. (*----------------------------------------------------------------------*)
  201.  
  202. VAR
  203.    Status_Line_Attr        : INTEGER (* Color attribute for status line *);
  204.    Status_ForeGround_Color : INTEGER (* Text color for status line      *);
  205.    Status_BackGround_Color : INTEGER (* Background color for status line*);
  206.    Reverse_Status_Colors   : BOOLEAN (* TRUE to use inverse term colors *);
  207.  
  208. (*----------------------------------------------------------------------*)
  209. (*                    VT100 emulation colors                            *)
  210. (*----------------------------------------------------------------------*)
  211.  
  212. VAR
  213.    VT100_ForeGround_Color : INTEGER  (* VT100 foreground color         *);
  214.    VT100_BackGround_Color : INTEGER  (* VT100 background color         *);
  215.    VT100_Border_Color     : INTEGER  (* VT100 border color             *);
  216.    VT100_Underline_Color  : INTEGER  (* VT100 foreground color         *);
  217.    VT100_Bold_Color       : INTEGER  (* VT100 background color         *);
  218.  
  219. (*----------------------------------------------------------------------*)
  220. (*                    Graphics emulation colors                         *)
  221. (*----------------------------------------------------------------------*)
  222.  
  223. VAR
  224.    Graphics_ForeGround_Color : INTEGER  (* Graphics mode foreground color *);
  225.    Graphics_BackGround_Color : INTEGER  (* Graphics mode background color *);
  226.  
  227. (*----------------------------------------------------------------------*)
  228. (*                      Program Option Flags                            *)
  229. (*----------------------------------------------------------------------*)
  230.  
  231. CONST
  232.    ON   = TRUE                       (* Convenient synonym for switches *);
  233.    OFF  = FALSE                      (* Likewise                        *);
  234.  
  235. VAR
  236.    Local_Echo          : BOOLEAN   (* Local Echo ON/OFF                 *);
  237.    BS_Char             : CHAR      (* CHAR to send when Back Space hit  *);
  238.    Ctrl_BS_Char        : CHAR      (* CHAR to send when CTRL BS hit     *);
  239.    Silent_Mode         : BOOLEAN   (* TRUE to suppress bells, music.    *);
  240.    Printer_On          : BOOLEAN   (* Echo to printer                   *);
  241.    Capture_On          : BOOLEAN   (* Capture mode on                   *);
  242.    Exact_Capture       : BOOLEAN   (* TRUE for exact capture mode       *);
  243.    Translate_On        : BOOLEAN   (* Translate mode on                 *);
  244.    Add_LF              : BOOLEAN   (* Add line feeds to incoming lines  *);
  245.    Play_Music_On       : BOOLEAN   (* Play music if found               *);
  246.    Pibterm_Done        : BOOLEAN   (* Finished running PibTerm          *);
  247.    Gossip_Mode_On      : BOOLEAN   (* Split-screen gossip mode          *);
  248.    Reset_Comm_Port     : BOOLEAN   (* TRUE to reset comm port           *);
  249.    Comm_Port_Changed   : BOOLEAN   (* TRUE if comm port number changed  *);
  250.    Host_Mode           : BOOLEAN   (* TRUE if PibTerm in host mode      *);
  251.    Last_Column_Hit     : BOOLEAN   (* TRUE if col 80 hit in display     *);
  252.    Auto_Wrap_Mode      : BOOLEAN   (* TRUE for autowrap on long lines   *);
  253.    Exploding_Menus     : BOOLEAN   (* TRUE to use exploding menus       *);
  254.    Review_On           : BOOLEAN   (* TRUE if review buffer used        *);
  255.    Script_File_Mode    : BOOLEAN   (* TRUE if currently exec'ing script *);
  256.    Script_Learn_Mode   : BOOLEAN   (* TRUE if currently learning script *);
  257.    CompuServe_B_On     : BOOLEAN   (* CompuServe B protocol in VT52     *);
  258.    Mahoney_On          : BOOLEAN   (* Mahoney BBS codes allowed         *);
  259.    When_Mode           : BOOLEAN   (* TRUE if WHEN string defined       *);
  260.    When_Drop_Mode      : BOOLEAN   (* TRUE if WHENDROP in effect        *);
  261.    WaitQuiet_Mode      : BOOLEAN   (* TRUE if WAITQUIET in effect       *);
  262.    WaitCount_Mode      : BOOLEAN   (* TRUE if WAITCOUNT in effect       *);
  263.    WaitString_Mode     : BOOLEAN   (* TRUE if WAITSTRING string defined *);
  264.    Read_In_Script      : BOOLEAN   (* TRUE to read in script            *);
  265.    Really_Wait_String  : BOOLEAN   (* TRUE to really wait for string    *);
  266.    Write_Screen_Memory : BOOLEAN   (* TRUE to write video memory direct *);
  267.    Write_Screen_Memory_Par : BOOLEAN (* TRUE to write video direct -- param *);
  268.    Alter_Baud_Rate     : BOOLEAN   (* TRUE to get baud rate from modem  *);
  269.    Check_CTS           : BOOLEAN   (* TRUE to check clear-to-send line  *);
  270.    Check_DSR           : BOOLEAN   (* TRUE to check data-set-ready line *);
  271.    Hard_Wired          : BOOLEAN   (* TRUE if hard-wired connection     *);
  272.    Drop_Dtr_At_End     : BOOLEAN   (* TRUE to drop DTR when closing port*);
  273.    Close_Comm_For_Dos  : BOOLEAN   (* TRUE to drop DTR when Alt-J done  *);
  274.    Wait_For_Retrace    : BOOLEAN   (* TRUE to wait for retrace in DSW   *);
  275.    Wait_For_Retrace_Par: BOOLEAN   (* TRUE to wait for retrace -- param *);
  276.    Show_Status_Line    : BOOLEAN   (* TRUE to display line 25 status    *);
  277.    Show_Status_Time    : BOOLEAN   (* TRUE to display time on line 25   *);
  278.    Do_Status_Time      : BOOLEAN   (* TRUE to show time on status line  *);
  279.    Save_Do_Status_Time : BOOLEAN   (* Saves status time check           *);
  280.    Do_Status_Line      : BOOLEAN   (* TRUE to show status line          *);
  281.    Do_Xon_Xoff_Checks  : BOOLEAN   (* TRUE to use xon/xoff flow control *);
  282.    Evict_Partial_Trans : BOOLEAN   (* TRUE to throw away bad downloads  *);
  283.    Use_Dos_Exec_In_Jump: BOOLEAN   (* TRUE to use DOS EXEC when jumping *)
  284.                                    (* to DOS                            *);
  285.    Use_Ymodem_Header   : BOOLEAN   (* Send block 0 in Ymodem non-batch  *);
  286.    Use_Block_Zero      : BOOLEAN   (* Use block 0 info when received    *);
  287.    Extended_Keypad     : BOOLEAN   (* Allow extended keypad keys        *);
  288.    Attended_Mode       : BOOLEAN   (* TRUE if running attended          *);
  289.    Edit_Insert_Mode    : BOOLEAN   (* TRUE if insert mode by default    *);
  290.    Auto_Load_FunKeys   : BOOLEAN   (* TRUE to autoload function keys    *);
  291.    Use_Dos_Buffer_In   : BOOLEAN   (* TRUE to use DOS function $A       *);
  292.    YTerm_On            : BOOLEAN   (* TRUE if YTerm transfers allowed   *);
  293.    Debug_Mode          : BOOLEAN   (* TRUE if Debug mode on             *);
  294.    Use_Dos_Con_Output  : BOOLEAN   (* TRUE to use DOS console writes    *);
  295.    Auto_Unload_Scripts : BOOLEAN   (* TRUE to auto unload scripts       *);
  296.    Do_Script_Tests     : BOOLEAN   (* TRUE to do script-related checks  *);
  297.    Use_EMM_For_Overlays: BOOLEAN   (* TRUE to put overlays in EMM       *);
  298.    Keyboard_Locked     : BOOLEAN   (* TRUE if keyboard locked           *);
  299.    Auto_Find_FileNames : BOOLEAN   (* TRUE to find file names in trans. *);
  300.    Rlink_Prompt_Each   : BOOLEAN   (* TRUE to prompt each file, Rlink   *);
  301.    Graphics_Terminal_Mode : BOOLEAN (* TRUE if graphics terminal        *);
  302.    EGA_Present         : BOOLEAN   (* TRUE if EGA installed             *);
  303.    ATI_Ega_Wonder      : BOOLEAN   (* If ATI Wonder EGA installed       *);
  304.    Cursor_Underline    : BOOLEAN   (* TRUE = underline cursor           *);
  305.    Cursor_Blink        : BOOLEAN   (* TRUE if cursor blinks             *);
  306.    Auto_Strip_High_Bit : BOOLEAN   (* TRUE to strip high bit in term.   *);
  307.    Software_Scroll     : BOOLEAN   (* TRUE to use software scrolling.   *);
  308.    Software_Scroll_Par : BOOLEAN   (* TRUE to use software scrolling.   *);
  309.  
  310.    Current_Carrier_Status : BOOLEAN (* Has current carrier detect status*);
  311.    New_Carrier_Status     : BOOLEAN (* Has new carrier detect status    *);
  312.    Carrier_Dropped        : BOOLEAN (* TRUE if carrier dropped          *);
  313.    Video_Handler_Installed: BOOLEAN (* TRUE if new int $10 handler inst.*);
  314.    Send_Upper_Case_Only   : BOOLEAN (* TRUE to send upper case only     *);
  315.    Log_File_Open          : BOOLEAN (* TRUE if log file open            *);
  316.    Logging_On             : BOOLEAN (* TRUE to write to log             *);
  317.  
  318. (*----------------------------------------------------------------------*)
  319. (*                           Global files                               *)
  320. (*----------------------------------------------------------------------*)
  321.  
  322. VAR
  323.    Capture_File        : Text_File (* Capture file                      *);
  324.    Script_File         : Text_File (* Script file                       *);
  325.    Log_File            : Text_File (* Log file for host mode            *);
  326.  
  327.    Capture_File_Name   : FileStr   (* Capture file name                 *);
  328.    Config_File_Name    : FileStr   (* Configuration file name           *);
  329.    Dialing_File_Name   : FileStr   (* Dialing directory file name       *);
  330.    Function_Key_Name   : FileStr   (* Function key file name            *);
  331.    Translate_File_Name : FileStr   (* Translate table file name         *);
  332.    Prefix_File_Name    : FileStr   (* Dialing prefix file name          *);
  333.    Log_File_Name       : FileStr   (* Log file name                     *);
  334.  
  335.    Home_Dir_Path       : FileStr   (* Home Directory Path for PibTerm   *);
  336.    Home_Dir            : FileStr   (* Home Directory for PibTerm        *);
  337.    Home_Drive          : CHAR      (* Home Drive Letter for PibTerm     *);
  338.    Download_Dir_Path   : FileStr   (* Download directory name           *);
  339.    Upload_Dir_Path     : FileStr   (* Upload directory name             *);
  340.    Script_Path         : FileStr   (* Script path                       *);
  341.    Function_Key_Path   : FileStr   (* Function key path                 *);
  342.  
  343.    Screen_Dump_Name  : FileStr     (* Screen dump file name             *);
  344.    Graphics_Dump_Name: FileStr     (* Graphics mode screen dump name    *);
  345.    Script_File_Name  : FileStr     (* Script file name                  *);
  346.    Saved_Script_File_Name : FileStr(* Saved script file name            *);
  347.    Editor_Name       : FileStr     (* Path for editor                   *);
  348.    Browser_Name      : FileStr     (* Path for file browser             *);
  349.  
  350. (*----------------------------------------------------------------------*)
  351. (*                      Host mode globals                               *)
  352. (*----------------------------------------------------------------------*)
  353.  
  354. VAR
  355.    Privilege           : CHAR      (* Host mode privilege level         *);
  356.    Host_Mode_Upload    : FileStr   (* Upload path for host mode         *);
  357.    Host_Mode_Download  : FileStr   (* Download path for host mode       *);
  358.    Host_Mode_Blank_Time: REAL      (* Time after which to blank screen  *);
  359.    Host_CTTY_Device    : STRING[8] (* CTTY Device driver name prefix    *);
  360.  
  361. (*----------------------------------------------------------------------*)
  362. (*                      Spooled print file                              *)
  363. (*----------------------------------------------------------------------*)
  364.  
  365. CONST
  366.    Max_Spool_Buffer_Count = 512;
  367.  
  368. TYPE
  369.    Spool_File_Buffer_Type = ARRAY[1..Max_Spool_Buffer_Count] OF CHAR;
  370.    Spool_File_Buffer_Ptr  = ^Spool_File_Buffer_Type;
  371.  
  372. VAR
  373.    Spool_File_Handle  : INTEGER    (* File handle for spooling file     *);
  374.    Spool_Buffer_Count : INTEGER    (* Characters in current buffer      *);
  375.    Spool_Buffer_Pos   : INTEGER    (* Offset of current char in buffer  *);
  376.    Spool_Buffer       : Spool_File_Buffer_Ptr  (* Spooling buffer       *);
  377.    Print_Spooling     : BOOLEAN    (* TRUE if file being printed        *);
  378.    Printer_Setup      : AnyStr     (* Printer setup string              *);
  379.  
  380. (*----------------------------------------------------------------------*)
  381. (*                         Review buffer                                *)
  382. (*----------------------------------------------------------------------*)
  383.  
  384. CONST
  385.    Max_Review_Line_Length = 253    (* Maximum chars in each review line *);
  386.  
  387. TYPE
  388.    Review_Buffer_Type = ARRAY[1..1] OF CHAR;
  389.    Review_Buffer_Ptr  = ^Review_Buffer_Type;
  390.  
  391. VAR
  392.    Max_Review_Length : INTEGER     (* Number of chars in review buffer *);
  393.  
  394.                                    (* Review buffer pointer *)
  395.    Review_Buffer     : Review_Buffer_Ptr;
  396.  
  397.    Review_Line       : AnyStr      (* Current line                      *);
  398.    Review_Head       : INTEGER     (* Head of review buffer             *);
  399.    Review_Tail       : INTEGER     (* Tail of review buffer             *);
  400.  
  401. (*----------------------------------------------------------------------*)
  402. (*          Definitions for keyboard interrupt handling                 *)
  403. (*----------------------------------------------------------------------*)
  404.  
  405. CONST
  406.    Kbd_Interrupt    = 9            (* Keyboard interrupt number  *);
  407.    Kbd_ROM_Data     = $0040        (* Segment with keyboard data *);
  408.    Kbd_Flag         = $0017        (* Byte 1 of keyboard status  *);
  409.    Kbd_Flag1        = $0018        (* Byte 2 of keyboard status  *);
  410.    Kbd_Head         = $001A        (* Buffer head pointer        *);
  411.    Kbd_Tail         = $001C        (* Buffer tail pointer        *);
  412.    Kbd_Buffer       = $001E        (* Default buffer location    *);
  413.    Kbd_Buffer_End   = $003E        (* End of default buffer      *);
  414.  
  415. CONST                              (* Save previous keyboard interrupt status *)
  416.                                    (* Note:  THESE MUST BE IN CODE SEGMENT!   *)
  417.    Kbd_Save_Iaddr2 : INTEGER = 0;
  418.    Kbd_Save_Iaddr1 : INTEGER = 0;
  419.  
  420. (*----------------------------------------------------------------------*)
  421. (*                    PibTerm Command Key Definitions                   *)
  422. (*----------------------------------------------------------------------*)
  423.  
  424. CONST
  425.    No_Misc_Keys = 5;
  426.  
  427. CONST
  428.    Alt_A = 30;      Alt_J = 36;      Alt_S = 31;
  429.    Alt_B = 48;      Alt_K = 37;      Alt_T = 20;
  430.    Alt_C = 46;      Alt_L = 38;      Alt_U = 22;
  431.    Alt_D = 32;      Alt_M = 50;      Alt_V = 47;
  432.    Alt_E = 18;      Alt_N = 49;      Alt_W = 17;
  433.    Alt_F = 33;      Alt_O = 24;      Alt_X = 45;
  434.    Alt_G = 34;      Alt_P = 25;      Alt_Y = 21;
  435.    Alt_H = 35;      Alt_Q = 16;      Alt_Z = 44;
  436.    Alt_I = 23;      Alt_R = 19;
  437.  
  438.    Alt_1 = 120;     Alt_5 = 124;     Alt_9 = 128;
  439.    Alt_2 = 121;     Alt_6 = 125;     Alt_0 = 129;
  440.    Alt_3 = 122;     Alt_7 = 126;     Alt_Minus = 130;
  441.    Alt_4 = 123;     Alt_8 = 127;     Alt_Equal = 131;
  442.  
  443.    Shift_Tab = 15;  Ctrl_Tab  = 151; Alt_Tab   = 172;
  444.  
  445.    F1        = 59;  Alt_F1   = 104;
  446.    F2        = 60;  Alt_F2   = 105;
  447.    F3        = 61;  Alt_F3   = 106;
  448.    F4        = 62;  Alt_F4   = 107;
  449.    F5        = 63;  Alt_F5   = 108;
  450.    F6        = 64;  Alt_F6   = 109;
  451.    F7        = 65;  Alt_F7   = 110;
  452.    F8        = 66;  Alt_F8   = 111;
  453.    F9        = 67;  Alt_F9   = 112;
  454.    F10       = 68;  Alt_F10  = 113;
  455.    Shift_F1  = 84;  Ctrl_F1  = 94;
  456.    Shift_F10 = 93;  Ctrl_F10 = 103;
  457.  
  458.    U_Arrow   = 72;  Alt_U_Arrow = 175;  Ctrl_U_Arrow = 160;
  459.    D_Arrow   = 80;  Alt_D_Arrow = 183;  Ctrl_D_Arrow = 164;
  460.    L_Arrow   = 75;  Alt_L_Arrow = 178;  Ctrl_L_Arrow = 115;
  461.    R_Arrow   = 77;  Alt_R_Arrow = 180;  Ctrl_R_Arrow = 116;
  462.  
  463.    Home      = 71;  Alt_Home      = 174;  Ctrl_Home      = 119;
  464.    End_Key   = 79;  Alt_End_Key   = 182;  Ctrl_End_Key   = 117;
  465.    PgUp      = 73;  Alt_PgUp      = 176;  Ctrl_PgUp      = 132;
  466.    PgDn      = 81;  Alt_PgDn      = 184;  Ctrl_PgDn      = 118;
  467.    Ins_Key   = 82;  Alt_Ins_Key   = 185;  Ctrl_Ins_Key   = 165;
  468.    Del_Key   = 83;  Alt_Del_Key   = 186;  Ctrl_Del_Key   = 166;
  469.    Kpd_Minus = 74;  Alt_Kpd_Minus = 177;  Ctrl_Kpd_Minus = 161;
  470.    Kpd_Plus  = 78;  Alt_Kpd_Plus  = 181;  Ctrl_Kpd_Plus  = 163;
  471.    Kpd_5     = 76;  Alt_Kpd_5     = 179;  Ctrl_Kpd_5     = 162;
  472.  
  473.    Alt_Enter  = 28; Alt_BS        = 171;
  474.  
  475.    PrtSc      = 255;
  476.    Ctrl_PrtSc = 114;
  477.    Alt_PrtSc  = 55;
  478.  
  479. VAR
  480.    Funk_Bases:  ARRAY[1..4]  OF BYTE (* Function key scan code bases *);
  481.    Keypad_Nos:  ARRAY[0..12] OF BYTE (* Keypad indices               *);
  482.    Number_Nos:  ARRAY[0..12] OF BYTE (* Alt-# indices                *);
  483.    Ctrl_Keys :  ARRAY[0..12] OF BYTE (* Ctrl-keypad indices          *);
  484.    Misc_Keys :  ARRAY[1..No_Misc_Keys] OF BYTE (* Miscellaneous indices*);
  485.  
  486. (*----------------------------------------------------------------------*)
  487. (*                   Auxilliary keyboard buffers                        *)
  488. (*----------------------------------------------------------------------*)
  489.  
  490. VAR
  491.    Keyboard_Buffer   : AnyStr      (* Holds program generated input  *);
  492.    Keyboard_Line     : AnyStr      (* Holds manually generated input *);
  493.    Keyboard_Line_Pos : INTEGER     (* Position in keyboard line      *);
  494.  
  495.                                    (* Command-key definitions        *)
  496. VAR
  497.    Alt_Let_Set       : SET OF BYTE;
  498.  
  499. (*----------------------------------------------------------------------*)
  500. (*                   Incoming/Outgoing key definitions                  *)
  501. (*----------------------------------------------------------------------*)
  502.  
  503. TYPE
  504.    Key_Record = RECORD
  505.                    Def  : KeyStrPtr;
  506.                    Name : STRING[3];
  507.                 END;
  508.  
  509. VAR
  510.                                    (* Key strings *)
  511.  
  512.    Key_Definitions  : ARRAY[0..255] OF Key_Record;
  513.  
  514.                                    (* Maps input key to Keypad/Number   *)
  515.  
  516.    Keypad_Key_Index : ARRAY[0..255] OF BYTE;
  517.  
  518.    Key_No           : INTEGER      (* Key number to execute             *);
  519.  
  520.    FK_CR        : CHAR             (* Function key definition CR        *);
  521.    FK_Delay     : CHAR             (* Function key def. 1 second wait   *);
  522.    FK_Wait_For  : CHAR             (* Function key wait for next char   *);
  523.    FK_Ctrl_Mark : CHAR             (* Marks next char as ctrl character *);
  524.    FK_Script_Ch : CHAR             (* Script to execute follows         *);
  525.    FK_Delay_Time: INTEGER          (* Delay to insert between each char *);
  526.  
  527.                                    (* Incoming character translate table *)
  528.  
  529.    TrTab        : ARRAY[CHAR] OF CHAR;
  530.  
  531. (*----------------------------------------------------------------------*)
  532. (*               Global communications variables                        *)
  533. (*----------------------------------------------------------------------*)
  534.  
  535. VAR
  536.    Data_Bits   : 5..8;
  537.    Parity      : CHAR;
  538.    Stop_Bits   : 0..2;
  539.    Comm_Port   : 1..4;
  540.    Baud_Rate   : 110..19200;
  541.  
  542. (*----------------------------------------------------------------------*)
  543. (*          Global variables for view file/directory/area codes         *)
  544. (*----------------------------------------------------------------------*)
  545.  
  546. VAR
  547.    View_Count     : INTEGER;
  548.    View_Line      : STRING[128];
  549.    View_Done      : BOOLEAN;
  550.    View_Char      : STRING[1];
  551.    View_Y         : INTEGER;
  552.  
  553. (*----------------------------------------------------------------------*)
  554. (*           Types and Variables for Terminal Emulation Facilities      *)
  555. (*----------------------------------------------------------------------*)
  556.  
  557. CONST
  558.    NumberTerminalTypes   = 14       (* # terminal types - 1         *);
  559.    Actual_N_Of_Terminals = 15       (* # terminal types implemented *);
  560.    Max_User_Terminals    = 5        (* # user terminals allowed     *);
  561.  
  562. TYPE
  563.    Terminal_Type = ( Dumb,     VT52,     Ansi,   VT100,  Gossip,
  564.                      HostMode, TEK4010,  ADM3a,  ADM5,   TV925,
  565.                      User1,    User2,    User3,  User4,  User5   );
  566.  
  567. VAR
  568.                                    (* Type of terminal to emulate      *)
  569.    Terminal_To_Emulate : Terminal_Type;
  570.  
  571.                                    (* Saves previous term. type        *)
  572.    Saved_Gossip_Term   : Terminal_Type;
  573.  
  574.                                    (* List of terminals to emulate     *)
  575.  
  576.    Terminal_Type_List  : ARRAY[0..NumberTerminalTypes] OF Terminal_Type;
  577.  
  578.                                    (* Terminal names *)
  579.  
  580.    Terminal_Name_List  : ARRAY[0..NumberTerminalTypes] OF STRING[7];
  581.  
  582.                                    (* Names for status line *)
  583. VAR
  584.    Status_Line_Name    : STRING[132];
  585.    Short_Terminal_Name : STRING[20];
  586.  
  587. VAR                                (* VT100 answerback message *)
  588.  
  589.    VT100_Answerback_Message : STRING[20];
  590.  
  591.                                      (* Remember cursor/attributes      *)
  592.    Save_Row_Position     : INTEGER   (* Save row position               *);
  593.    Save_Col_Position     : INTEGER   (* Save column position            *);
  594.    Save_BG_Color         : INTEGER   (* Save background color           *);
  595.    Save_FG_Color         : INTEGER   (* Save foreground color           *);
  596.    Save_Graphics_Mode    : BOOLEAN   (* Save graphics mode              *);
  597.    Save_Bolding          : BOOLEAN   (* Save bolding mode               *);
  598.    Save_Blinking         : BOOLEAN   (* Save blinking mode              *);
  599.    Save_Done             : BOOLEAN   (* If save actually done           *);
  600.    Save_Origin_Mode      : BOOLEAN   (* Save origin mode setting        *);
  601.    Save_Top_Scroll       : INTEGER   (* Save top line in scrolling reg. *);
  602.    Save_Bottom_Scroll    : INTEGER   (* Save bottom line in scroll reg. *);
  603.  
  604.    Ansi_ForeGround_Color : INTEGER   (* Global foreground color here    *);
  605.    Ansi_BackGround_Color : INTEGER   (* Global background color here    *);
  606.    Ansi_Underline_Color  : INTEGER   (* Color for underlines            *);
  607.    Ansi_Bold_Color       : INTEGER   (* Color for bolding               *);
  608.  
  609.    FG                    : INTEGER   (* Foreground color                *);
  610.    BG                    : INTEGER   (* Background color                *);
  611.  
  612.    Save_Global_FG        : INTEGER   (* Save global foreground color    *);
  613.    Save_Global_BG        : INTEGER   (* Save global background color    *);
  614.    Save_FG               : INTEGER   (* Save foreground color           *);
  615.    Save_BG               : INTEGER   (* Save background color           *);
  616.    Save_EG               : INTEGER   (* Save border color               *);
  617.    Save_FG1              : INTEGER   (* Save foreground color           *);
  618.    Save_BG1              : INTEGER   (* Save background color           *);
  619.  
  620.                                    (* General emulation variables *)
  621. VAR
  622.    Graphics_Mode       : BOOLEAN   (* TRUE if graphics mode on        *);
  623.    Alt_KeyPad_Mode     : BOOLEAN   (* TRUE if alternate keypad in use *);
  624.    Hold_Screen_Mode    : BOOLEAN   (* TRUE if in hold screen mode     *);
  625.    Reset_Requested     : BOOLEAN   (* TRUE to reset terminal          *);
  626.    Auto_Print_Mode     : BOOLEAN   (* IF auto print mode in effect    *);
  627.    Printer_Ctrl_Mode   : BOOLEAN   (* IF printer controller mode on   *);
  628.    Insertion_Mode      : BOOLEAN   (* If insertion mode on            *);
  629.    Double_Width_Mode   : BOOLEAN   (* Double width characters         *);
  630.    Skip_All_Mode       : BOOLEAN   (* Skip all chars in line          *);
  631.    Bolding_On          : BOOLEAN   (* TRUE if bolding on              *);
  632.    Blinking_On         : BOOLEAN   (* TRUE if blinking on             *);
  633.    Reverse_On          : BOOLEAN   (* TRUE if reverse video on        *);
  634.    Width_132           : BOOLEAN   (* TRUE if 132 column mode         *);
  635.    New_Line            : BOOLEAN   (* TRUE if LF -> CR +LF            *);
  636.    Getting_Music       : BOOLEAN   (* TRUE if getting music           *);
  637.    Origin_Mode         : BOOLEAN   (* TRUE for region origin mode     *);
  638.    Auto_Change_Arrows  : BOOLEAN   (* TRUE to handle cursor key mode  *)
  639.                                    (* changes in VT100 emulation.     *);
  640.  
  641.                                    (* Escape mode processing      *)
  642. VAR
  643.    Escape_Mode         : BOOLEAN     (* If processing escape sequence   *);
  644.    Escape_Number       : INTEGER     (* # of numeric parms in esc seq.  *);
  645.  
  646.                                      (* Holds numeric parms in esc seq  *)
  647.    Escape_Register     : ARRAY[1..100] OF BYTE;
  648.    Escape_Str          : AnyStr      (* Collects string arg in esc seq  *);
  649.    Escape_Type         : CHAR        (* Type of escape seq. being done  *);
  650.    Reg_Val             : INTEGER     (* General utility register value  *);
  651.  
  652.                                      (* Attributes for each line        *)
  653.  
  654.    Line_Attributes     : ARRAY[1..100] OF BYTE;
  655.  
  656.                                      (* Save current scrolling region   *)
  657.    Top_Scroll          : INTEGER;
  658.    Bottom_Scroll       : INTEGER;
  659.  
  660.    Ansi_Last_Line      : INTEGER   (* Last line in display *);
  661.  
  662.                                    (* LED status in VT100  *)
  663.  
  664.    VT100_Led_Vector    : ARRAY[1..4] OF BOOLEAN;
  665.  
  666. VAR                                (* Names of user-defined terminals *)
  667.  
  668.    User_Term_Name      : ARRAY[1..Max_User_Terminals] OF FileStr;
  669.  
  670. (*--------------------------------------------------------------------------*)
  671. (*                    Display action type definitions                       *)
  672. (*--------------------------------------------------------------------------*)
  673.  
  674. (*--------------------------------------------------------------------------*)
  675. (*   CursorUp        --- Move cursor up one line                            *)
  676. (*   CursorDown      --- Move cursor down one line                          *)
  677. (*   CursorLeft      --- Move cursor left one column                        *)
  678. (*   CursorRight     --- Move cursor right one column                       *)
  679. (*   ClearScreen     --- Clear entire screen                                *)
  680. (*   ClearEOS        --- Clear to end of screen from current position       *)
  681. (*   ClearSCur       --- Clear from start of screen to current position     *)
  682. (*   ClearLine       --- Clear entire line                                  *)
  683. (*   ClearEOL        --- Clear to end of line                               *)
  684. (*   ClearLCur       --- Clear start of line to current position            *)
  685. (*   CursorHome      --- Home the cursor                                    *)
  686. (*   InsertCharA     --- Insert a character after current position          *)
  687. (*   InsertCharB     --- Insert a character before current position         *)
  688. (*   InsertLineA     --- Insert line after current line                     *)
  689. (*   InsertLineB     --- Insert line before current line                    *)
  690. (*   DeleteChar      --- Delete character at current position               *)
  691. (*   DeleteLine      --- Delete current line                                *)
  692. (*   StartInsert     --- Enter character insertion mode                     *)
  693. (*   EndInsert       --- Exit character insertion mode                      *)
  694. (*   NormalVideo     --- Enter normal video mode                            *)
  695. (*   ReverseVideo    --- Enter reverse video mode                           *)
  696. (*   StartBlink      --- Start blink mode                                   *)
  697. (*   EndBlink        --- End blink mode                                     *)
  698. (*   StartUnderline  --- Start underline mode                               *)
  699. (*   EndUnderline    --- End underline mode                                 *)
  700. (*   StartBold       --- Start bold mode                                    *)
  701. (*   EndBold         --- End bold mode                                      *)
  702. (*   ReverseIndex    --- Reverse line feed                                  *)
  703. (*   PrintLine       --- Print current line                                 *)
  704. (*   PrintPage       --- Print whole screen                                 *)
  705. (*   CursorPos       --- Position cursor                                    *)
  706. (*   StartAltKey     --- Enter alternate keypad mode                        *)
  707. (*   EndAltKey       --- End alternate keypad mode                          *)
  708. (*   StartAutoPrint  --- Start autoprint mode                               *)
  709. (*   EndAutoPrint    --- End autoprint mode                                 *)
  710. (*   SetTab          --- Set tab stop                                       *)
  711. (*   ClearTab        --- Clear tab stop                                     *)
  712. (*   StartDim        --- Start dim mode                                     *)
  713. (*   EndDim          --- End dim mode                                       *)
  714. (*--------------------------------------------------------------------------*)
  715.  
  716.  
  717. TYPE
  718.    Display_Action = ( CursorUp,        CursorDown,     CursorLeft,    CursorRight,
  719.                       ClearScr,        ClearScrH,      ClearEOS,      ClearSCur,
  720.                       ClearLine,
  721.                       ClearEOL,        ClearLCur,      CursorHome,    InsertCharA,
  722.                       InsertCharB,     InsertLineA,    InsertLineB,   DeleteChar,
  723.                       DeleteLine,      StartInsert,    EndInsert,     NormalVideo,
  724.                       ReverseVideo,    StartBlink,     EndBlink,      StartUnderline,
  725.                       EndUnderline,    StartBold,      EndBold,
  726.                       StartDim,        EndDim,         ReverseIndex,
  727.                       PrintLine,       PrintPage,      CursorPosVT52, StartAltKey,
  728.                       EndAltKey,       StartAutoPrint, EndAutoPrint,  SetTab,
  729.                       ClearTab,        DisplayChar,    StartPrintControl,
  730.                       EndPrintControl, IdentifyVT52,
  731.                       StartGraphicsMode, EndGraphicsMode, TV950Video, Swallow,
  732.                       CursorPosH,        CursorPosV,
  733.                       StartVT52HoldScreen, EndVT52HoldScreen,
  734.                       EnterVT100, EnterVT52,
  735.                       ExecPCCommands, SendMahoneyOn,
  736.                       EnterState1, EnterState2, EnterState3, EnterState4, EnterState5,
  737.                       Index, VT52HT, VT52LF
  738.                     );
  739.  
  740.    Display_Action_Vector_Type   = ARRAY[CHAR] OF Display_Action;
  741.    Display_Action_Vector_Ptr    = ^Display_Action_Vector_Type;
  742.  
  743.    Display_Action_Chars_Type    = ARRAY[1..1] OF CHAR;
  744.    Display_Action_Actions_Type  = ARRAY[1..1] OF Display_Action;
  745.  
  746.    Display_Action_Chars_Ptr     = ^Display_Action_Chars_Type;
  747.    Display_Action_Actions_Ptr   = ^Display_Action_Actions_Type;
  748.  
  749.    Character_Vector_Type        = ARRAY[CHAR] OF CHAR;
  750.    Character_Vector_Ptr_Type    = ^Character_Vector_Type;
  751.  
  752. (*--------------------------------------------------------------------------*)
  753. (*                    Display action vectors                                *)
  754. (*--------------------------------------------------------------------------*)
  755.  
  756. CONST
  757.    MaxDisplayStates   = 10;
  758.    MaxDisplayCharSets = 5;
  759.  
  760. TYPE
  761.    Tab_Stop_Vector    = ARRAY[1..132] OF BYTE;
  762.  
  763. VAR
  764.    Display_Action_Ptr      : ARRAY[1..MaxDisplayStates] OF Display_Action_Vector_Ptr;
  765.    Display_Action_State    : 1..MaxDisplayStates;
  766.  
  767.    Display_Char_Set_Ptr    : ARRAY[1..MaxDisplayCharSets] OF Character_Vector_Ptr_Type;
  768.    Character_Set_Ptr       : Character_Vector_Ptr_Type;
  769.  
  770.                                        (* Tab stuff *)
  771. VAR
  772.    Number_Tab_Stops        : INTEGER   (* Number of tabs currently defined *);
  773.  
  774.                                        (* Tab positions                    *)
  775.  
  776.    Tab_Stops               : Tab_Stop_Vector;
  777.  
  778. (*----------------------------------------------------------------------*)
  779. (*           Global variables for phone directory handling              *)
  780. (*----------------------------------------------------------------------*)
  781.  
  782. CONST
  783.    Max_Phone_Prefixes        = 5;
  784.    Max_Dial_Nos              = 10;
  785.    Dialing_Dir_Entry_Length  = 79;
  786.  
  787. (* STRUCTURED *) CONST
  788.    Phone_Prefix_Chars   : ARRAY[ 1 .. Max_Phone_Prefixes ] OF CHAR
  789.                           = ( '+', '-', '!', '@', '#' );
  790.  
  791. TYPE
  792.  
  793.    Char_25  = PACKED ARRAY[ 1 .. 25 ] OF CHAR;
  794.    Char_15  = PACKED ARRAY[ 1 .. 15 ] OF CHAR;
  795.    Char_9   = PACKED ARRAY[ 1 .. 9  ] OF CHAR;
  796.    Char_8   = PACKED ARRAY[ 1 .. 8  ] OF CHAR;
  797.    Char_5   = PACKED ARRAY[ 1 .. 5  ] OF CHAR;
  798.    Char_2   = PACKED ARRAY[ 1 .. 2  ] OF CHAR;
  799.  
  800.    String30 = STRING[30];
  801.  
  802.                                    (* Dialing file entry *)
  803.    Phone_Number_Record = RECORD
  804.                             Phone_Name        : Char_25;
  805.                             Phone_Number      : Char_15;
  806.                             Phone_Baud        : Char_5;
  807.                             Phone_Parity      : CHAR;
  808.                             Phone_DataBits    : CHAR;
  809.                             Phone_StopBits    : CHAR;
  810.                             Phone_Echo        : CHAR;
  811.                             Phone_BackSpace   : CHAR;
  812.                             Phone_LineFeed    : CHAR;
  813.                             Phone_Term_Type   : CHAR;
  814.                             Phone_Trans_Type  : Char_2;
  815.                             Phone_Script      : Char_9;
  816.                             Phone_Last_Date   : Char_8;
  817.                             Phone_Last_Time   : Char_8;
  818.                          END;
  819.                                    (* Dialing directory *)
  820.  
  821.    Dialing_Directory_Type = ARRAY[1..1] OF Phone_Number_Record;
  822.  
  823.    Dialing_Directory_Ptr  = ^Dialing_Directory_Type;
  824.  
  825.    Dialing_List_Record    = RECORD
  826.                                Number: STRING[30];
  827.                                Tries : INTEGER;
  828.                             END;
  829.  
  830. VAR
  831.                                    (* Current phone entry data *)
  832.  
  833.    Phone_Entry_Data    : Phone_Number_Record;
  834.  
  835.                                    (* Current phone record number *)
  836.    Phone_Entry_Number  : INTEGER;
  837.                                    (* Current phone page number   *)
  838.    Phone_Entry_Page    : INTEGER;
  839.                                    (* Current phone section       *)
  840.    Dialing_Page        : INTEGER;
  841.                                    (* Phone prefix numbers      *)
  842.  
  843.    Phone_Prefix_Nos    : ARRAY[ 1 .. Max_Phone_Prefixes ] OF ShortStr;
  844.  
  845.    Default_Prefix      : CHAR      (* Default prefix character    *);
  846.    Default_Postfix     : CHAR      (* Default postfix character   *);
  847.    Phone_Number        : String30  (* Phone number to dial        *);
  848.    Prefix_Str          : ShortStr  (* Phone number prefix         *);
  849.    Postfix_Str         : ShortStr  (* Phone number postfix        *);
  850.  
  851.    N_Dial_Nos          : INTEGER   (* # of dial list entries      *);
  852.    I_Dial_Nos          : INTEGER   (* Current dial list entry     *);
  853.  
  854.                                    (* Dialing list entries        *)
  855.  
  856.    Dial_Nos            : ARRAY[1..Max_Dial_Nos] OF Dialing_List_Record;
  857.  
  858.                                    (* Dialing directory size *)
  859.    Dialing_Dir_Size    : INTEGER;
  860.    Dialing_Dir_Size_Max: INTEGER;
  861.                                    (* Phone directory *)
  862.  
  863.    Dialing_Directory   : Dialing_Directory_Ptr;
  864.  
  865.    Use_Short_Dial_Menu : BOOLEAN   (* TRUE to use 1-line dial prompt *);
  866.  
  867.    Any_Dialing_Changes : BOOLEAN   (* TRUE if any dialing entries changed *);
  868.  
  869.    Script_Dialed       : BOOLEAN   (* TRUE if doing linked script       *);
  870.  
  871. (*----------------------------------------------------------------------*)
  872. (*                     Global variables for modem                       *)
  873. (*----------------------------------------------------------------------*)
  874.  
  875. VAR
  876.    Modem_Init          : AnyStr    (* Modem initialization string *);
  877.    Modem_Dial          : ShortStr  (* Modem dialing command       *);
  878.    Modem_Dial_End      : ShortStr  (* Modem end for dial command  *);
  879.    Modem_Busy          : ShortStr  (* Modem return if line busy   *);
  880.    Modem_Connect       : ShortStr  (* Modem connect message       *);
  881.    Modem_No_Carrier    : ShortStr  (* Modem no carrier message    *);
  882.    Modem_Escape        : ShortStr  (* Modem escape command        *);
  883.    Modem_Escape_Time   : INTEGER   (* Time in mil. for escape     *);
  884.    Modem_Hang_Up       : ShortStr  (* Modem hangup command        *);
  885.    Modem_Time_Out      : REAL      (* Modem time out value        *);
  886.    Modem_Redial_Delay  : REAL      (* Modem redial delay          *);
  887.    Modem_Answer        : ShortStr  (* Modem answer phone          *);
  888.    Modem_Host_Set      : AnyStr    (* Modem host mode setup       *);
  889.    Modem_Host_UnSet    : AnyStr    (* Modem host mode endup       *);
  890.    Modem_Command_Delay : INTEGER   (* Ms between command chars    *);
  891.    Modem_Carrier_High  : BOOLEAN   (* TRUE if carrier line high   *);
  892.    Modem_Ring          : ShortStr  (* Modem ring detect message   *);
  893.    Host_Auto_Baud      : BOOLEAN   (* Attempt auto speed detect   *);
  894.  
  895. (*----------------------------------------------------------------------*)
  896. (*                 Global variables for file transfers                  *)
  897. (*----------------------------------------------------------------------*)
  898.  
  899. CONST
  900.                    (* Special characters used in XMODEM *)
  901.  
  902.    SOH   = $01;                    (* Start of XMODEM block       *)
  903.    STX   = $02;                    (* Start of Ymodem block       *)
  904.    EOT   = $04;                    (* End of XMODEM transmission  *)
  905.    ACK   = $06;                    (* Acknowledge an XMODEM block *)
  906.    NAK   = $15;                    (* Refuse an XMODEM block      *)
  907.    SYN   = $16;                    (* Start of Telink header      *)
  908.    CAN   = $18;                    (* Cancel XMODEM transfer      *)
  909.  
  910. CONST
  911.    MaxSectorLength         = 5000  (* Length of sector data storage *);
  912.    MaxFileHandleBuffer     = 2048  (* Length of file handle buffer  *);
  913.  
  914. TYPE
  915.    Sector_Type             = ARRAY[ 1 .. MaxSectorLength     ] OF BYTE;
  916.    File_Handle_Buffer_Type = ARRAY[ 1 .. MaxFileHandleBuffer ] OF BYTE;
  917.    File_Handle_Buffer_Ptr  = ^File_Handle_Buffer_Type;
  918.  
  919. VAR
  920.    Sector_Size      : INTEGER      (* Size of Xmodem sector             *);
  921.  
  922.                                    (* One sector of data                *)
  923.    Sector_Data      : Sector_Type;
  924.  
  925.    Sector_Number    : INTEGER      (* Current sector number being sent  *);
  926.  
  927.    Max_Write_Buffer : INTEGER      (* File transfer buffer size         *);
  928.  
  929.  
  930.                    (* Transfer Declarations *)
  931. TYPE
  932.    Transfer_Type = ( Ascii, Xmodem_Chk, Xmodem_CRC, Kermit, Telink,
  933.                      Modem7_Chk, Modem7_CRC, Xmodem_1K, Xmodem_1KG,
  934.                      Ymodem_Batch, Ymodem_G, Zmodem, WXModem, Rlink,
  935.                      SeaLink, YTerm, PUser1, PUser2, PUser3, PUser4,
  936.                      PUser5, None );
  937.  
  938. CONST
  939.    Max_Transfer_Types = 22;
  940.  
  941. VAR                                (* Vector of available transfer types *)
  942.  
  943.    Transfers            : ARRAY[ 1 .. Max_Transfer_Types ] OF Transfer_Type;
  944.  
  945.                                    (* Vector of long transfer type names *)
  946.  
  947.    Transfer_Name_List   : ARRAY[ 1 .. Max_Transfer_Types ] OF String12;
  948.  
  949.                                    (* Vector of short transfer type names *)
  950.  
  951.    Trans_Type_Name      : ARRAY[ Transfer_Type ] OF Char_2;
  952.  
  953.                                    (* If protocol OK for use in host mode *)
  954.  
  955.    Trans_OK_In_Host     : ARRAY[ Transfer_Type ] OF BOOLEAN;
  956.  
  957.                                    (* Non-batch protocols *)
  958.  
  959.    Single_File_Protocol : ARRAY[Transfer_Type] OF BOOLEAN;
  960.  
  961.                                    (* Script names for external handlers *)
  962.  
  963.    Receive_Script_Names : ARRAY[ Transfer_Type ] OF String12;
  964.    Send_Script_Names    : ARRAY[ Transfer_Type ] OF String12;
  965.  
  966.                    (* File for Xmodem family transfers *)
  967. VAR
  968.    XFile_Handle        : INTEGER   (* Xmodem File uploaded/downloaded   *);
  969.    FileName            : AnyStr    (* Name of file                      *);
  970.    Saved_Kbd_File_Name : AnyStr    (* Saved keyboard line with filename *);
  971.  
  972.                    (* Timing/Delay Constants and Variables *)
  973. CONST
  974.    One_Second     =  1             (* One second                       *);
  975.    Two_Seconds    =  2             (* Two seconds                      *);
  976.    Five_Seconds   =  5             (* Five seconds                     *);
  977.    Ten_Seconds    = 10             (* Ten seconds                      *);
  978.    Twenty_Seconds = 20             (* Twenty seconds                   *);
  979.    Sixty_Seconds  = 60             (* Sixty seconds                    *);
  980.    Trans_Time_Val = 1800.0         (* Fudge factor for transfer times  *);
  981.  
  982. VAR
  983.    Ascii_Char_Delay  : INTEGER     (* Character delay for Ascii trans.  *);
  984.    Ascii_Line_Delay  : INTEGER     (* Line delay for Ascii transfers    *);
  985.    Ascii_CR_LF_String: STRING[2]   (* CR or CR+LF to end ASCII lines    *);
  986.    Ascii_Line_Size   : INTEGER     (* Line size for stream transfers    *);
  987.  
  988.                    (* Save/restore transmission params during XMODEM *)
  989.  
  990. VAR
  991.    Xmodem_Bits_Save  : INTEGER     (* Save # bits per character         *);
  992.    Xmodem_Parity_Save: CHAR        (* Save parity                       *);
  993.    Xmodem_Stop_Save  : INTEGER     (* Save stop bits                    *);
  994.  
  995. VAR
  996.    Xmodem_Char_Wait   : INTEGER    (* Character wait for Xmodem trans.  *);
  997.    Xmodem_Block_Wait  : INTEGER    (* Interblock wait for Xmodem trans. *);
  998.    Xmodem_Ack_Wait    : INTEGER    (* ACK wait time for Xmodem trans.   *);
  999.    Xmodem_Max_Errors  : INTEGER    (* Maximum errors in Xmodem          *);
  1000.  
  1001. VAR                                (* Default transfer type             *)
  1002.    Default_Transfer_Type : Transfer_Type;
  1003.  
  1004. VAR
  1005.    Stop_Receive    : BOOLEAN       (* TRUE to cancel receiving of file. *);
  1006.    Stop_Send       : BOOLEAN       (* TRUE to cancel sending of file.   *);
  1007.    Use_Time_Sent   : BOOLEAN       (* TRUE to stamp file with received  *)
  1008.                                    (* time and date.                    *);
  1009.    Null_File_Name  : BOOLEAN       (* TRUE if null file name in Ymodem  *);
  1010.    Ascii_Use_CtrlZ : BOOLEAN       (* TRUE if CtrlZ used as EOF marker  *);
  1011.    Ascii_Show_Text : BOOLEAN       (* TRUE to display text during trans.*);
  1012.    Ascii_Send_Blank: BOOLEAN       (* TRUE to send empty lines as blank *);
  1013.    Ascii_Send_Asis : BOOLEAN       (* TRUE to send text as is           *);
  1014.    Display_Status  : BOOLEAN       (* TRUE to display transfer status   *);
  1015.    Ascii_Translate : BOOLEAN       (* TRUE to use translate tab in down.*);
  1016.    Ascii_Pacing_Char : CHAR        (* Pacing character for uploads      *);
  1017.    Downsize_Ymodem : BOOLEAN       (* TRUE to allow downsize in Ymodem  *);
  1018.    Script_Transfer : BOOLEAN       (* TRUE if doing transfer in script  *);
  1019.    GMT_Difference  : INTEGER       (* Difference in hours between local *)
  1020.                                    (* time and Greenwich mean time      *);
  1021.    Transfer_Bells  : INTEGER       (* Number of bells after transfer    *);
  1022.    YTerm_Mode      : CHAR          (* YTERM transfer mode               *);
  1023.    Do_WXModem      : BOOLEAN       (* TRUE to do WXModem                *);
  1024.    Do_SeaLink      : BOOLEAN       (* TRUE to do SeaLink                *);
  1025.    Zmodem_BlockSize: INTEGER       (* Length for Zmodem transfers       *);
  1026.  
  1027.